package com.yc.hotel.autorunner;

import java.io.File;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import com.yc.hotel.util.ConstantInfo;

@Component
public class CreateUploadPathListener implements CommandLineRunner{

	@Value("${web.upload-path}")
	private String basePath;
	
	@Override
	public void run(String... args) throws Exception {
		File fl = new File(basePath, ConstantInfo.UPLOADPATH);
		if(!fl.exists()) {
			fl.mkdirs();
		}
		ConstantInfo.basePath = basePath;
	}

}
